package com.dat255.tentatime;

import java.util.LinkedList;

import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ListView;


public class ResultActivity extends ListActivity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		setContentView(R.layout.result);
		
		LinkedList<Exam> examList = new LinkedList<Exam>();
		
		
		examList.add(new Exam("RMA123","Diskret for dummies","12:00","24/12/2011","VV-salar"));
		examList.add(new Exam("DAT123","Diskret ","12:00","24/12/2011","VV-salar"));
		examList.add(new Exam("SVT123","for dummies","12:00","24/12/2011","VV-salar"));
		examList.add(new Exam("KLO123","dummies","12:00","24/12/2011","VV-salar"));
		
		setListAdapter(new ExamAdapter(this, R.layout.result_row, examList ));
		
	}

	@Override
	protected void onListItemClick(ListView l, View v, int position, long id) {
	
		super.onListItemClick(l, v, position, id);
		// Get the item that was clicked
				Exam o = (Exam) this.getListAdapter().getItem(position);
			
				Intent examIntent = new Intent(ResultActivity.this, ShowExamActivity.class);
				examIntent.putExtra("selected exam", o);
				ResultActivity.this.startActivity(examIntent); 
				/*Toast.makeText(this, "You selected: " + o.getCourseID() +" " + o.getCourseName() + " " + o.getDate() + " " + o.getPlace(), Toast.LENGTH_LONG)
						.show();*/
	}
	
}